namespace Columbus.ActionResults
{
    /// <summary>
    /// Back result is returned to make navigator navigate back 
    /// </summary>
    public class BackResult : ActionResult
    {
        private readonly INavigator navigator;

        /// <summary>
        /// Initializes a new instance of the <see cref="BackResult"/> class.
        /// </summary>
        /// <param name="context">Navigation context.</param>
        public BackResult(NavigationContext context)
            : base(context)
        {
            navigator = context.Navigator;
        }

        /// <summary>
        /// Executes result.
        /// </summary>
        protected override void ExecuteInternal()
        {
            navigator.NavigateBack();
        }
    }
}